#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int posix_fs_test(int argc, char** argv) {
    int fd = open("/emmc1/ZDYZ.TXT", O_RDONLY);
    if(fd >= 0) {
		char buf[32];
		ssize_t len = read(fd, buf, 32);
		if(len >= 0) {
			buf[len] = '\0';
			printf("Data read() from /emmc1/ZDYZ.TXT: \n\r%s\n\r", buf);
		}
		close(fd);
    }

	FILE* fp = fopen("/sd1/hello.txt", "r");
	if(fp) {
		char buf[32];
		char *msg = fgets(buf, 32, fp);
		printf("Data fgets() from /sd1/hello.txt: \n\r%s\n\r", msg);
		fclose(fp);
	} else {
		printf("Open /sd1/ZDYZ.TXT failed !\n\r");
	}

	return 0;
}
